<?php
/**
 * Add/Updade Job Workflow Popup
 * 
 * @author Xavier VILAIN
 * @package Hive\Mission\Workflow
 * @license #hive-missions#
 * 
 */


use Fox\Ressources\Script;
use Fox\Ressources;
use Fox\Html\TextArea;
use Fox\Html\Block;
use Fox\Html\Wrapper;
use Fox\Generator;
use Fox\Popup\Modify;
use Fox\Html\Input;

if(!Fox\Authorization\Manager::check(Hive\Admin\Customizing::AUTH_MISSION_BOARDS)) {
	echo $xview->accessDenied(Msg(Hive::BUNDLE,Hive::ERR_ADMIN_ACCES_DENIED),null,true);
	exit;
}
$xview = Xview::instance();

$popup = new Modify(null,
					Hive\Workflow::className(),
					array(Hive::BUNDLE,Hive::MISSION_WORKFLOW_ADD_TITLE)
					);
					
$wrapper = new Wrapper('wWorkflow','');
// Header Part
$blHeader= new Block('wHeader',Msg(Fox\Msg::BUNDLE,Fox\Msg::MSG_HEADER_DATA));
$blHeader
		->collapsed(false)
		->add(new Input(array('workflow_label','label'),true))->parentObject()
		->add(new TextArea(array('workflow_description','description'),true));
$wrapper->add($blHeader);
// Steps Part
$blSteps = new Block('wSteps',Msg(Hive::BUNDLE,Hive::MISSION_WORKFLOW_STEPS));
$grid = $xview->module(Generator::url('missions','workflows','steps'));
$blSteps->add($grid);
$wrapper->add($blSteps);
$popup
	->callback(Generator::ajaxReload('contentCol'))
	->width(600)
	->block($wrapper)
	;
echo $popup->display();
$ressource = $xview->loadRessource(array('mod' => 'missions','act' => 'workflows','sac'=> 'steps'));
$ressource->dumpContent(false);
echo $ressource->dump(true);